﻿using System;
using System.Collections.Generic;
using System.Xml;
using TaleWorlds.ObjectSystem;

namespace TaleWorlds.Core
{
	// Token: 0x02000022 RID: 34
	public class CharacterSkills : PropertyOwner<SkillObject>
	{
		// Token: 0x060001B3 RID: 435 RVA: 0x0000732D File Offset: 0x0000552D
		public CharacterSkills(CharacterSkills propertyOwner) : base(propertyOwner)
		{
		}

		// Token: 0x060001B4 RID: 436 RVA: 0x00007336 File Offset: 0x00005536
		public CharacterSkills()
		{
		}

		// Token: 0x060001B5 RID: 437 RVA: 0x00007340 File Offset: 0x00005540
		public override void Deserialize(MBObjectManager objectManager, XmlNode node)
		{
			this.Initialize();
			foreach (object obj in node.ChildNodes)
			{
				XmlNode xmlNode = (XmlNode)obj;
				if (xmlNode.NodeType != XmlNodeType.Comment)
				{
					XmlAttributeCollection attributes = xmlNode.Attributes;
					string value = attributes["id"].Value;
					string value2 = attributes["value"].Value;
					SkillObject @object = Game.Current.ObjectManager.GetObject<SkillObject>(value);
					if (@object != null)
					{
						int value3 = (value2 != null) ? Convert.ToInt32(value2) : 1;
						base.SetPropertyValue(@object, value3);
					}
				}
			}
			foreach (object obj2 in node.ChildNodes)
			{
				XmlNode xmlNode2 = (XmlNode)obj2;
				if (xmlNode2.NodeType != XmlNodeType.Comment)
				{
					string text = xmlNode2.Name;
					int value4 = 1;
					if (text == "skill")
					{
						text = null;
						if (xmlNode2.Attributes != null)
						{
							XmlAttribute xmlAttribute = xmlNode2.Attributes["id"];
							if (xmlAttribute != null)
							{
								text = xmlAttribute.InnerText;
							}
						}
					}
					if (text != null)
					{
						SkillObject object2 = Game.Current.ObjectManager.GetObject<SkillObject>(text);
						if (object2 != null)
						{
							XmlAttribute xmlAttribute2 = xmlNode2.Attributes["value"];
							if (xmlAttribute2 != null)
							{
								string value5 = xmlAttribute2.Value;
								value4 = ((value5 != null) ? Convert.ToInt32(value5) : 1);
							}
							base.SetPropertyValue(object2, value4);
						}
					}
				}
			}
		}

		// Token: 0x060001B6 RID: 438 RVA: 0x000074EC File Offset: 0x000056EC
		internal static void AutoGeneratedStaticCollectObjectsCharacterSkills(object o, List<object> collectedObjects)
		{
			((CharacterSkills)o).AutoGeneratedInstanceCollectObjects(collectedObjects);
		}

		// Token: 0x060001B7 RID: 439 RVA: 0x000074FA File Offset: 0x000056FA
		protected override void AutoGeneratedInstanceCollectObjects(List<object> collectedObjects)
		{
			base.AutoGeneratedInstanceCollectObjects(collectedObjects);
		}
	}
}
